-- FETCH_BLACK_MARKET_GOODS

-- 抽取黑市摊贩商品
return function()
    local ret = {};

    -- 违禁药品2个
    table.insert(ret, { ["goodsId"] = 1601, });
    table.insert(ret, { ["goodsId"] = 1601, });

    -- 水银骰子
    table.insert(ret, { ["goodsId"] = 1602, });

    -- 杂物抽取X个
    local arr = {1603, 1604, {1605, 1606, 1607, 1608}};

    -- 是否抽取拆弹装置
    local boomMachine = false;
    if DungeonServiceM.queryDungeonAttrib("black_market_feel") >= 100 and
        DungeonShopM.getGoodsBuyTime(1609) <= 0 then
        -- 好感度满了，并且没有买过
        boomMachine = true;
    end

    local count;
    if boomMachine then
        count = 1;
    else
        count = 2;
    end

    for i = 1, count do
        local rand = DungeonM.getRandSeed("FETCH_BLACK_MARKET_GOODS");
        local index = rand % #arr + 1; -- 注意：客户端的下标比服务器大1
        local goodsId = arr[index];
        if type(goodsId) == "number" then
            table.insert(ret, { ["goodsId"] = goodsId, });
        else
            -- 数组里再抽1个
            rand = DungeonM.getRandSeed("FETCH_BLACK_MARKET_GOODS");
            index = rand % #goodsId + 1; -- 注意：客户端的下标比服务器大1
            goodsId = goodsId[index];
            table.insert(ret, { ["goodsId"] = goodsId, });
        end
    end

    if boomMachine then
        -- 拆弹装置
        table.insert(ret,  { ["goodsId"] = 1609, });
    end

    return ret;
end